﻿Public Class oiml

    'Public Shared dbConn As String = "Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Data Source=DGO-PC\SQLEXPRESS;Initial catalog=SistemaRC"
    Public Shared dbConn As String = Global.Sigeco.My.MySettings.Default.dbConn
    '"Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Data Source=localhost\SQLExpress;Initial catalog=SistemaRCV2"

    'System.Configuration.ConfigurationManager.AppSettings("dbConn")
    Public Shared idUsuario As Integer = 1
    Public Shared Usuario As String = "Admin"
    Public Shared UsuarioNombre As String = "Admin"

    Public Shared codEstadoCierreNota As Integer = 6
    Public Shared codEstadoProduccionNota As Integer = 2
    Public Shared codEstadoAnulaNota As Integer = 11

    Public Shared Function ControlPermiso(idUsuario As Integer, Funcion As String) As Boolean
        'Dim usu As New Controller.
        'If usu.controlAccesosPermisos(dbConn, idUsuario, Funcion) Then
        Return True
        'Else
        '    Return False
        'End If
    End Function

    Public Shared Sub Log(idUsuario As Integer, logDescrip As String, idFuncion As Integer, Optional dt As DataTable = Nothing)
        'Dim log__1 As New Controller.

        'If log__1.Insert_Log(oiml.dbConn, logDescrip, idUsuario, idFuncion, dt) = 0 Then

        '    MessageBox.Show("Error: " & log__1.MessageError.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        'End If

    End Sub

    Public Shared Sub CargarCombos(ByRef ddl As ComboBox, ByVal display As String, ByVal value As String, ByVal dt As DataTable)
        If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
            ddl.DataSource = dt
            ddl.DisplayMember = display
            ddl.ValueMember = value

        Else

            ddl.DataSource = Nothing

        End If
    End Sub


End Class
